import%20marimo%0A%0A__generated_with%20%3D%20%220.11.7%22%0Aapp%20%3D%20marimo.App(width%3D%22medium%22)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_()%3A%0A%20%20%20%20import%20marimo%20as%20mo%0A%20%20%20%20return%20(mo%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%22%22%22Author%3A%20Ashkan%20Nikfarjam%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20%23%23%23%3Cspan%20style%3D%22color%3A%20green%22%3EProject%20Overview%3C%2Fspan%3E%20%0A%0A%20%20%20%20%20%20%20%20We%20analyze%20gene%20expression%20patterns%20in%20breast%20tissue%20samples%20to%20identify%20differentially%20expressed%20genes%20associated%20with%20early-stage%20breast%20cancer%20and%20to%20study%20cancer%20progression.%20Our%20goal%20is%20to%20develop%20a%20predictive%20model%20that%20accurately%20assesses%20breast%20cancer%20prognosis%2C%20improving%20early%20detection%20and%20treatment%20planning.%22%0A%20%20%20%20%20%20%20%20Lot%20of%20early%20research%20paper%20were%20sujesting%20using%20models%20such%20as%20HMM%20how%20ever%20these%20models%20are%20Require%20pre-selected%20features%20(e.g.%2C%20from%20AHP-based%20ranking).%20May%20miss%20complex%20interactions%20between%20genes%20because%20they%20rely%20on%20predefined%20relationships.%20Thus%20we%20decided%20to%20use%20deep%20learning%20approach%20to%20be%20able%20to%20create%20a%20robust%20model%20for%20subtype%20classificatino%20and%20also%20assist%20us%20with%20prognosis%20studies.%20We%20migh%20still%20use%20ahp%20analysis%20for%20some%20side%20edas.%20as%20well%20as%20corolation%20analysis%20on%20clinical%20variables%20helping%20furthur%20diganosis.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20%23%20%3Cspan%20style%3D%22color%3Agreen%22%3EData%20Source%3C%2Fspan%3E%0A%0A%20%20%20%20%20%20%20%20The%20Gene%20Expression%20dataset%20has%20been%20extracted%20from%20the%20%5BNCBI%20Gene%20Expression%20Omnibus%20GSEGSE62944%5D(https%3A%2F%2Fwww.ncbi.nlm.nih.gov%2Fgeo%2Fquery%2Facc.cgi%3Facc%3DGSE62944).%20The%20dataset%20consists%20of%209264%20tumor%20samples%20and%20741%20normal%20samples%20across%2024%20cancer%20types%20from%20The%20Cancer%20Genome%20Atlas.%20This%20data%20set%20is%20created%20from%20all%20the%20TCGA%20samples%20that%20have%20an%20expression%20of%2023%2C000%20genes!%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.image(src%3D%22TCGAcancerTypes.png%22%2Ccaption%3D%22The%20Camer%20Types%20available%20in%20TCGA%20database.%20This%20image%20is%20from%20the%20TCGA%20officcial%20website!%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%22%22%22According%20to%20%5BNCBI%5D(%22%22)%2020%20years%20after%20the%20original%20publication%20of%20the%20human%20genome%2C%20the%20number%20of%20protein-coding%20genes%20is%20stabilizing%20around%2019%2C500%20(Figure%202)%2C%20although%20the%20number%20of%20isoforms%20of%20these%20genes%20is%20still%20a%20subject%20of%20intensive%20study%20and%20discussion.%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20%23%23%20%3Cspan%20style%3D%22color%3A%20green%22%3EExpression%20Collection%20Methods%3A%20%0A%0A%20%20%20%20%20%20%20%20Next-Generation%20Sequencing%20(NGS)%20is%20a%20high-throughput%20method%20for%20sequencing%20DNA%20by%20following%20a%20series%20of%20steps.%20First%2C%20in%20library%20preparation%2C%20the%20genome%20is%20fragmented%20into%20smaller%20pieces%2C%20and%20short%20adapter%20sequences%20are%20attached%20to%20both%20ends%2C%20forming%20a%20DNA%20library.%20Next%2C%20in%20bridge%20amplification%2C%20these%20fragments%20are%20hybridized%20to%20a%20solid%20surface%20and%20undergo%20multiple%20amplification%20cycles%2C%20creating%20clusters%20of%20identical%20DNA%20fragments.%20In%20sequencing%2C%20fluorescently%20labeled%20nucleotides%20are%20incorporated%20into%20the%20DNA%20strands%2C%20and%20a%20camera%20captures%20the%20emitted%20signals%20to%20determine%20the%20sequence%20of%20each%20fragment%20through%20multiple%20sequencing%20cycles.%20Finally%2C%20in%20alignment%20and%20data%20analysis%2C%20the%20short%20DNA%20reads%20are%20aligned%20to%20a%20reference%20genome%2C%20overlapping%20regions%20are%20assembled%20into%20contigs%2C%20and%20the%20final%20sequence%20is%20reconstructed.%20This%20efficient%20and%20scalable%20technique%20is%20widely%20used%20in%20genomic%20research%2C%20cancer%20studies%2C%20transcriptomics%2C%20and%20personalized%20medicine.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.image(src%3D%22NGS.png%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20In%20this%20data%20the%20gene%20expression%20is%20normalized%20using%20FPKM%20and%20TPM%20where%20value%20of%20matrix%20represent%20the%20ratio%20of%20read%20per%20killobase%20or%20million.%20%0A%0A%20%20%20%20%20%20%20%20%5C%5B%0A%20%20%20%20%20%20%20%20FPKM%20%3D%20%5Cfrac%7B%5Ctext%7BReads%20per%20gene%7D%7D%7B%5Ctext%7BGene%20length%20(kb)%7D%20%5Ctimes%20%5Ctext%7BTotal%20mapped%20reads%20(millions)%7D%7D%0A%20%20%20%20%20%20%20%20%5C%5D%0A%0A%20%20%20%20%20%20%20%20and%0A%0A%20%20%20%20%20%20%20%20%5C%5B%0A%20%20%20%20%20%20%20%20%5Ctext%7BRPK%7D%20%3D%20%5Cfrac%7B%5Ctext%7BReads%20per%20gene%7D%7D%7B%5Ctext%7BGene%20length%20(kb)%7D%7D%0A%20%20%20%20%20%20%20%20%5C%5D%0A%0A%20%20%20%20%20%20%20%20and%20finaly%20%0A%0A%20%20%20%20%20%20%20%20%5C%5B%0A%20%20%20%20%20%20%20%20TPM%20%3D%20%5Cfrac%7B%5Ctext%7BRPK%7D%7D%7B%5Csum%20%5Ctext%7BRPK%7D%7D%20%5Ctimes%2010%5E6%0A%20%20%20%20%20%20%20%20%5C%5D%0A%0A%20%20%20%20%20%20%20%20Our%20research%20sujest%20TPM%20(Transcripts%20Per%20Million)%20over%20FPKM%20(Fragments%20Per%20Kilobase%20per%20Million%20reads)%20because%20it%20ensures%20consistency%20across%20samples%20by%20normalizing%20for%20gene%20length%20before%20sequencing%20depth.%20Unlike%20FPKM%2C%20TPM%20guarantees%20that%20the%20total%20expression%20across%20all%20genes%20sums%20to%20one%20million%2C%20making%20values%20directly%20comparable%20across%20different%20datasets.%20This%20prevents%20biases%20from%20varying%20sequencing%20depths%20and%20avoids%20inflation%20of%20expression%20values%20in%20smaller%20samples.%20Additionally%2C%20TPM%20corrects%20for%20discrepancies%20in%20lowly%20expressed%20genes%20by%20proportionally%20scaling%20read%20counts%2C%20leading%20to%20more%20accurate%20cross-sample%20comparisons.%20This%20means%20this%20data%20can%20be%20used%20to%20classify%20any%20gene%20expression%20samples%20as%20long%20as%20they%20are%20within%20the%2024%20cancer%20type%20that%20this%20dataset%20represent%20including%20breast%20cancer.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20%23%23%23%20%3Cspan%20style%3D%22color%3A%20green%22%3EData%20Files%20in%20GSE62944%0A%0A%20%20%20%20%20%20%20%20These%20are%20the%20available%20suplementory%20file%20for%20this%20geo%20dataset%20that%20we%20can%20use%20for%20labaling%20and%20creating%20our%20data%20set%20in%20csv%20format%20and%20furthermore%20creating%20Test%2FTrain%2FVal%20data%3A%20%0A%0A%20%20%20%20%20%20%20%20%7C%20Supplementary%20file%20%7C%20Discription%20%7CFile%20type%2Fresource%20%7C%0A%20%20%20%20%20%20%20%20%7C--------------------%7C------%7C--------------------%7C%0A%20%20%20%20%20%20%20%20%7C%20GSE62944_01_27_15_TCGA_20_420_Clinical_Variables_7706_Samples.txt.gz%20%7C%20548%20clinical%20variables%20for%20each%20sample%20are%20provided%20in%20the%20%7C%20TXT%20%7C%0A%20%20%20%20%20%20%20%20%7C%20GSE62944_01_27_15_TCGA_20_CancerType_Samples.txt.gz%20%7C%20list%20of%20mutated%20samples%20%7C%20TXT%20%7C%0A%20%20%20%20%20%20%20%20%7C%20GSE62944_06_01_15_TCGA_24_548_Clinical_Variables_9264_Samples.txt.gz%20%7C%20548%20clinical%20variables%20for%20each%20sample%20are%20provided%20in%20the%20%7C%20TXT%20%7C%0A%20%20%20%20%20%20%20%20%7C%20GSE62944_06_01_15_TCGA_24_CancerType_Samples.txt.gz%20%7C%20describes%2024%20cancers%20types%20by%20sample%20%7C%20TXT%20%7C%0A%20%20%20%20%20%20%20%20%7C%20GSE62944_06_01_15_TCGA_24_Normal_CancerType_Samples.txt.gz%20%7C%20list%20each%20sample%20normal%20samples%20respectively%20%7C%20TXT%20%7C%0A%20%20%20%20%20%20%20%20%7C%20GSE62944_RAW.tar%20%7C%205.9%20Gb%20of%20raw%20data%20%7C%20TAR%20(of%20TXT)%20%7C%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22%3Cspan%20style%3D%22color%3A%20brown%22%3E1.%20EDA%20for%2024%20cancer%20type%20file%3C%2Fspan%3E%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20pandas%20as%20pd%0A%20%20%20%20def%20create_supl_df(source%2C%20cancerType)%3A%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20this%20function%20creates%20data%20frame%20from%20a%20suplementart%20file%0A%20%20%20%20%20%20%20%20%20%20%20%20inout%3A%20suplementery%20file%20path%2C%20cancerType%20of%20interes%0A%20%20%20%20%20%20%20%20%20%20%20%20returns%20-%3E%20a%20data_frame%0A%0A%20%20%20%20%20%20%20%20%22%22%22%0A%0A%20%20%20%20%20%20%20%20%23read%20suplementory%20file%20%20%20%20%0A%20%20%20%20%20%20%20%20with%20open(source%2C%20'r')%20as%20file%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20data%3D%5Bline.split('%5Ct')%20for%20line%20in%20file.readlines()%5D%0A%0A%20%20%20%20%20%20%20%20data_dic%20%3D%20%7B%22Samples%22%3A%5B%5D%2C%20%22CancerType%22%3A%5B%5D%7D%0A%20%20%20%20%20%20%20%20for%20line%20in%20data%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20data_dic%5B'Samples'%5D.append(line%5B0%5D)%0A%20%20%20%20%20%20%20%20%20%20%20%20data_dic%5B'CancerType'%5D.append(line%5B1%5D)%0A%20%20%20%20%20%20%20%20cancer_type_df%20%3D%20pd.DataFrame(data_dic)%0A%20%20%20%20%20%20%20%20cancer_type_df%5B'CancerType'%5D%3Dcancer_type_df%5B'CancerType'%5D.str.strip()%0A%20%20%20%20%20%20%20%20cType_count%20%3D%20cancer_type_df.CancerType.value_counts()%0A%20%20%20%20%20%20%20%20cancer_type_df%20%3D%20cancer_type_df%5Bcancer_type_df%5B'CancerType'%5D%3D%3DcancerType%5D%0A%20%20%20%20%20%20%20%20return%20cancer_type_df%2C%20data%2C%20cType_count%0A%20%20%20%20return%20create_supl_df%2C%20pd%0A%0A%0A%40app.cell%0Adef%20_(create_supl_df)%3A%0A%20%20%20%20cancerBRCA_type_df%2C%20data%2C%20cType_count%3D%20create_supl_df('..%2F..%2Fdata%2FSuplementoryFiles%2FTCGA_24_CancerType_Samples.txt'%2C%20'BRCA')%0A%20%20%20%20return%20cType_count%2C%20cancerBRCA_type_df%2C%20data%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%22%22%22*%20These%20are%20the%20unique%20cancer%20types%20in%20dataset%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(cType_count)%3A%0A%20%20%20%20cType_count%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20and%20ther%20discription%3A%20%0A%0A%20%20%20%20%20%20%20%20%7C%20Cander%20Type%20%7C%20Description%20%7C%0A%20%20%20%20%20%20%20%20%7C-------------%7C-------------%7C%0A%20%20%20%20%20%20%20%20%7C%20%22PRAD%22%20%7C%20%22Prostate%20Adenocarcinoma%22%20%7C%0A%20%20%20%20%20%20%20%20%7C%20%22LGG%22%20%7C%20%22Low-Grade%20Glioma%22%20%7C%0A%20%20%20%20%20%20%20%20%7C%20%22OV%22%20%7C%20%22Ovarian%20Serous%20Cystadenocarcinoma%22%20%7C%0A%20%20%20%20%20%20%20%20%7C%20%22BRCA%22%7C%20%22Breast%20Invasive%20Carcinoma%22%20%7C%0A%20%20%20%20%20%20%20%20%7C%20%22SKCM%22%7C%20%22Skin%20Cutaneous%20Melanoma%22%20%7C%0A%20%20%20%20%20%20%20%20%7C%20%22LUAD%22%7C%20%22Lung%20Adenocarcinoma%22%20%7C%0A%20%20%20%20%20%20%20%20%7C%20%22LUSC%22%7C%20%22Lung%20Squamous%20Cell%20Carcinoma%22%20%7C%0A%20%20%20%20%20%20%20%20%7C%20%22THCA%22%7C%20%22Thyroid%20Carcinoma%22%20%7C%0A%20%20%20%20%20%20%20%20%7C%20%22UCEC%22%7C%20%22Uterine%20Corpus%20Endometrial%20Carcinoma%22%20%7C%0A%20%20%20%20%20%20%20%20%7C%20%22KIRP%22%7C%20%22Kidney%20Renal%20Papillary%20Cell%20Carcinoma%22%20%7C%0A%20%20%20%20%20%20%20%20%7C%20%22HNSC%22%7C%20%22Head%20and%20Neck%20Squamous%20Cell%20Carcinoma%22%20%7C%0A%20%20%20%20%20%20%20%20%7C%20%22CESC%22%7C%20%22Cervical%20Squamous%20Cell%20Carcinoma%20and%20Endocervical%20Adenocarcinoma%22%20%7C%0A%20%20%20%20%20%20%20%20%7C%20%22COAD%22%7C%20%22Colon%20Adenocarcinoma%22%20%7C%0A%20%20%20%20%20%20%20%20%7C%20%20%22ACC%22%7C%20%22Adrenocortical%20Carcinoma%22%20%7C%0A%20%20%20%20%20%20%20%20%7C%20%22KIRC%22%7C%20%22Kidney%20Renal%20Clear%20Cell%20Carcinoma%22%20%7C%0A%20%20%20%20%20%20%20%20%7C%20%20%22GBM%22%7C%20%22Glioblastoma%20Multiforme%22%20%7C%0A%20%20%20%20%20%20%20%20%7C%20%22BLCA%22%7C%20%22Bladder%20Urothelial%20Carcinoma%22%7C%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20%3Cspan%20style%3D%22color%3A%20brown%22%3E%202.%20the%20Normal_CancerType_Samples%3C%2Fspam%3E%0A%0A%20%20%20%20%20%20%20%20This%20text%20file%20list%20each%20normal%20samples%20respectively!%20lets%20take%20a%20look%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(create_supl_df)%3A%0A%20%20%20%20Normal_Sample_gene%2C_%2C_%20%3D%20create_supl_df('..%2F..%2Fdata%2FSuplementoryFiles%2FTCGA_Normal_CancerType_Samples%20.txt'%2C'BRCA')%0A%20%20%20%20Normal_Sample_gene%0A%20%20%20%20return%20(Normal_Sample_gene%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(r%22%22%22As%20we%20can%20see%20there%20are%20113%20normal%20cancer%20samples%20where%20i%20moght%20do%20%5B%2560%2C%20%2520%2C%20%2520%5D%20distribution%20for%20train%20test%20and%20val%20datasets%20witch%20would%20be%20%5B67%2C%2023%2C%2023%5D%20samples%20for%20healthy%20dataset!%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20%3Cspan%20style%3D%22color%3A%20brown%22%3E%203.%20the%20Malignant_CancerType_Samples%3C%2Fspam%3E%0A%0A%20%20%20%20%20%20%20%20list%20of%20mutated%20samples!%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(create_supl_df)%3A%0A%20%20%20%20melignent_df%2C%20_%2C%20_%3Dcreate_supl_df('..%2F..%2Fdata%2FSuplementoryFiles%2FTCGA_20_CancerType_Samples.txt'%2C%20'BRCA')%0A%20%20%20%20melignent_df%0A%20%20%20%20return%20(melignent_df%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20%23%20%3Cspan%20style%3D'color%3A%20brown'%3ERaw%20Gene%20Expression%20Data%3C%2Fsapn%3E%0A%0A%20%20%20%20%20%20%20%20now%20that%20we%20have%20all%20the%20samples%20data%20for%20healthy%20and%20cancerous%20data%20GSE62944_RAW.tar%20data.%0A%0A%20%20%20%20%20%20%20%20%7C%20File%20Name%20%7C%20Sample%20ID%20%7C%20Date%20%7C%20Platform%20%7C%20Condition%20%7C%20File%20Type%20%7C%20Use%7C%0A%20%20%20%20%20%20%20%20%7C-----------%7C----------%7C------%7C----------%7C-----------%7C-----------%7C-----------%7C%0A%20%20%20%20%20%20%20%20%7C%20GSM1536837_01_27_15_TCGA_20.Illumina.tumor_Rsubread_FeatureCounts.txt%20%7C%20GSM1536837%20%7C%2001_27_15%20%7C%20Illumina%20%7C%20Tumor%20%7C%20FeatureCounts%20%7C%20%20%7C%0A%20%20%20%20%20%20%20%20%7C%20GSM1536837_01_27_15_TCGA_20.Illumina.tumor_Rsubread_FPKM.txt%20%7C%20GSM1536837%20%7C%2001_27_15%20%7C%20Illumina%20%7C%20Tumor%20%7C%20FPKM%20%7C%20%7C%0A%20%20%20%20%20%20%20%20%7C%20GSM1536837_01_27_15_TCGA_20.Illumina.tumor_Rsubread_TPM.txt%20%7C%20GSM1536837%20%7C%2001_27_15%20%7C%20Illumina%20%7C%20Tumor%20%7C%20TPM%20%7C%20%7C%0A%20%20%20%20%20%20%20%20%7C%20GSM1536837_06_01_15_TCGA_24.tumor_Rsubread_FeatureCounts.txt%20%7C%20GSM1536837%20%7C%2006_01_15%20%7C%20TCGA%20%7C%20Tumor%20%7C%20FeatureCounts%20%7C%20%7C%0A%20%20%20%20%20%20%20%20%7C%20GSM1536837_06_01_15_TCGA_24.tumor_Rsubread_FPKM.txt%20%7C%20GSM1536837%20%7C%2006_01_15%20%7C%20TCGA%20%7C%20Tumor%20%7C%20FPKM%20%7C%20%7C%0A%20%20%20%20%20%20%20%20%7C%20GSM1536837_06_01_15_TCGA_24.tumor_Rsubread_TPM.txt%20%7C%20GSM1536837%20%7C%2006_01_15%20%7C%20TCGA%20%7C%20Tumor%20%7C%20TPM%20%7C%20%E2%9C%85%20%7C%0A%20%20%20%20%20%20%20%20%7C%20GSM1697009_06_01_15_TCGA_24.normal_Rsubread_FeatureCounts.txt%20%7C%20GSM1697009%20%7C%2006_01_15%20%7C%20TCGA%20%7C%20Normal%20%7C%20FeatureCounts%20%7C%20%7C%0A%20%20%20%20%20%20%20%20%7C%20GSM1697009_06_01_15_TCGA_24.normal_Rsubread_FPKM.txt%20%7C%20GSM1697009%20%7C%2006_01_15%20%7C%20TCGA%20%7C%20Normal%20%7C%20FPKM%20%7C%20%7C%0A%20%20%20%20%20%20%20%20%7C%20GSM1697009_06_01_15_TCGA_24.normal_Rsubread_TPM.txt%20%7C%20GSM1697009%20%7C%2006_01_15%20%7C%20TCGA%20%7C%20Normal%20%7C%20TPM%20%7C%20%E2%9C%85%20%7C%0A%0A%20%20%20%20%20%20%20%20Since%20the%20gene%20expressions%20are%20in%20text%20format%20I%20need%20to%20as%20well%20extract%20the%20gene%20expression%20matrix%20parsing%20through%20data!%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(pd)%3A%0A%20%20%20%20def%20get_samples_df(source%2C%20sample_list)%3A%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20%20%20%20%20this%20function%20takes%20in%20the%20file%20source%20and%20sample%20list%20of%20BRCA%0A%20%20%20%20%20%20%20%20%20%20%20%20then%20return%20the%20data%20frame%20that%20contains%20the%20all%20the%20genes%20and%20related%20benign%20and%20melignant%20samples%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20with%20open(source%2C%20'r')%20as%20file%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20extracted_data%20%3D%20%5Bline.strip().split(%22%5Ct%22)%20for%20line%20in%20file%5D%0A%20%20%20%20%20%20%20%20df%3Dpd.DataFrame(extracted_data)%0A%20%20%20%20%20%20%20%20%23%20Extract%20first%20row%20as%20column%20names%20and%20shift%20right%0A%20%20%20%20%20%20%20%20new_columns%20%3D%20%5B%22%22%5D%20%2B%20df.iloc%5B0%2C%20%3A-1%5D.tolist()%20%20%23%20Shift%20column%20names%20one%20position%20right%0A%0A%20%20%20%20%20%20%20%20%23%20Drop%20the%20first%20row%20since%20it's%20now%20the%20header%0A%20%20%20%20%20%20%20%20df%20%3D%20df.iloc%5B1%3A%5D.reset_index(drop%3DTrue)%0A%0A%20%20%20%20%20%20%20%20%23%20Assign%20the%20new%20column%20names%0A%20%20%20%20%20%20%20%20df.columns%20%3D%20new_columns%0A%0A%20%20%20%20%20%20%20%20%23we%20have%20all%20the%20data%20we%20need%20%0A%20%20%20%20%20%20%20%20%23lest%20extract%20the%20samples%20that%20are%20relate%20to%20normal%20or%20melignant%20dataset%0A%0A%20%20%20%20%20%20%20%20df%3Ddf.set_index(df.columns%5B0%5D)%0A%20%20%20%20%20%20%20%20df%3Ddf.loc%5B%3A%2Csample_list%5D%0A%20%20%20%20%20%20%20%20return%20df%0A%20%20%20%20return%20(get_samples_df%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%22%22%22%23%23%231.%20Normal%20Samples%20from%20GSM1697009_06_01_15_TCGA_24.normal_Rsubread_TPM.txt%3A%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(Normal_Sample_gene%2C%20get_samples_df)%3A%0A%20%20%20%20healthy_dataSet%20%3D%20get_samples_df('..%2F..%2Fdata%2FGSE62944_RAW%2FGSM1697009_06_01_15_TCGA_24.normal_Rsubread_TPM.txt'%2CNormal_Sample_gene%5B'Samples'%5D.to_list())%0A%20%20%20%20healthy_dataSet%3Dhealthy_dataSet.T%0A%20%20%20%20healthy_dataSet%3Dhealthy_dataSet.astype(float)%0A%20%20%20%20%23%20healthy_dataSet.to_csv('..%2F..%2Fdata%2FModelDataSets%2FhelthyExpressions.csv')%0A%20%20%20%20return%20(healthy_dataSet%2C)%0A%0A%0A%40app.cell%0Adef%20_(healthy_dataSet%2C%20mo)%3A%0A%20%20%20%20mo.ui.table(healthy_dataSet)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20%23%23%23%20%3Cspan%20style%3D%22color%3A%20green%22%3EVisually%20see%20the%20top%20300%20Genes%20in%20the%20Healthy%20samples%20dataset!%0A%0A%20%20%20%20%20%20%20%20Now%20lets%20see%20what%20are%20the%20most%20exressed%20genes%20in%20the%20BRCA%20genes.%20The%20mean%20expression%20for%20all%20the%20genes%20is%20selcted%20and%20following%20chart%20is%20showing%20the%20top%20300%20genes%20that%20had%20highes%20mean.%0A%0A%20%20%20%20%20%20%20%20**Note%3A**%20Even%20the%20genes%20has%20the%20most%20variations%20posses%20importance%20but%20this%20is%20not%20best%20way%20to%20calculate%20that.%20Instead%20we%20are%20going%20to%20use%20AHP%20analysis%20to%20rank%20the%20genes%20and%20analyze%20that%20more%20accurately.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(healthy_dataSet%2C%20mo%2C%20pd)%3A%0A%20%20%20%20import%20plotly.express%20as%20px%0A%20%20%20%20%23%20Extract%20genes%20and%20compute%20mean%20expression%0A%20%20%20%20genes%20%3D%20healthy_dataSet.columns%0A%20%20%20%20average%20%3D%20healthy_dataSet.mean(axis%3D0)%20%20%23%20Compute%20mean%20across%20all%20samples%0A%0A%20%20%20%20%23%20Create%20a%20new%20DataFrame%20with%20gene%20names%20and%20their%20average%20expression%0A%20%20%20%20plot_df%20%3D%20pd.DataFrame(%7B'Genes'%3A%20genes%2C%20'avg_expr_level'%3A%20average%7D)%0A%0A%20%20%20%20%23%20Sort%20and%20select%20the%20top%20300%20genes%20by%20expression%20level%0A%20%20%20%20plot_df%20%3D%20plot_df.sort_values(by%3D'avg_expr_level'%2C%20ascending%3DFalse).iloc%5B%3A300%5D%0A%0A%20%20%20%20%23%20Create%20an%20interactive%20bar%20plot%0A%20%20%20%20fig%20%3D%20mo.ui.plotly(%0A%20%20%20%20%20%20%20%20px.bar(plot_df%2C%20x%3D'Genes'%2C%20y%3D'avg_expr_level'%2C%0A%20%20%20%20%20%20%20%20title%3D%22Gene%20Expression%20Visualization%20for%20Top%20300%20Genes%22%2C%0A%20%20%20%20%20%20%20%20labels%3D%7B'avg_expr_level'%3A%20'Mean%20Expression%20Level'%7D%2C%0A%20%20%20%20%20%20%20%20color%3D'avg_expr_level'%20%20%23%20Optional%3A%20color%20for%20better%20visualization%0A%20%20%20%20%20%20%20%20).update_layout(xaxis_tickangle%3D-45)%0A%20%20%20%20)%0A%0A%20%20%20%20%23%20Rotate%20x-axis%20labels%20for%20better%20visibility%0A%20%20%20%20fig%0A%20%20%20%20return%20average%2C%20fig%2C%20genes%2C%20plot_df%2C%20px%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20%23%23%232.%20Melignant%20samples%20Samples%20from%20GSM1697009_06_01_15_TCGA_24.normal_Rsubread_TPM.txt%3A%0A%0A%20%20%20%20%20%20%20%20Now%20we%20are%20doing%20the%20same%20thing%20for%20toumor%20samples!%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(pd)%3A%0A%20%20%20%20%22%22%22%0A%20%20%20%20df1%20%3Dget_samples_df('..%2F..%2Fdata%2FGSE62944_RAW%2FGSM1536837_06_01_15_TCGA_24.tumor_Rsubread_TPM.txt'%2C%20cancerBRCA_type_df%5B'Samples'%5D.to_list())%0A%20%20%20%20df2%20%3Dget_samples_df('..%2F..%2Fdata%2FGSE62944_RAW%2FGSM1536837_06_01_15_TCGA_24.tumor_Rsubread_TPM.txt'%2C%20melignent_df%5B'Samples'%5D.to_list())%0A%20%20%20%20cancer_dataSet%20%3D%20pd.concat(%5Bdf1.T%2Cdf2.T%5D%2Cignore_index%3DFalse)%0A%20%20%20%20cancer_dataSet%3Dcancer_dataSet.astype(float)%0A%20%20%20%20%22%22%22%0A%0A%20%20%20%20cancer_dataSet%20%3D%20pd.read_csv('..%2F..%2Fdata%2FModelDataSets%2FcancerExpressions.csv')%0A%20%20%20%20return%20(cancer_dataSet%2C)%0A%0A%0A%40app.cell%0Adef%20_(cancer_dataSet%2C%20mo)%3A%0A%20%20%20%20cancer_dataSet.rename(columns%3D%7B'Unnamed%3A%200'%3A'Samples'%7D%2C%20inplace%3DTrue)%0A%20%20%20%20mo.ui.table(cancer_dataSet)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%22%22%22It%20seams%20like%20we%20have%202%2C200%20samples%20and%20for%20the%20model%20training%20using%2060%2C20%2C20%20distribution.%20We%20are%20going%20to%20have%20%5B1321%2C%20350%2C%20350%5D%20sample%20distribution%20for%20test%20train%20and%20val%20dataset!%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(cancer_dataSet%2C%20mo%2C%20pd%2C%20plot_df%2C%20px)%3A%0A%20%20%20%20plot_genes%3Dplot_df%5B'Genes'%5D.tolist()%0A%20%20%20%20average2%20%3D%20cancer_dataSet%5Bplot_genes%5D.mean(axis%3D0)%0A%20%20%20%20plot2_df%3D%20pd.DataFrame(%7B'Genes'%3Aplot_genes%2C'avg_expr_level'%3Aaverage2%7D)%0A%20%20%20%20fig2%20%3D%20mo.ui.plotly(%0A%20%20%20%20%20%20%20%20px.bar(plot2_df%2C%20x%3D'Genes'%2C%20y%3D'avg_expr_level'%2C%0A%20%20%20%20%20%20%20%20title%3D%22Gene%20Expression%20Visualization%20for%20Top%20300%20Genes%22%2C%0A%20%20%20%20%20%20%20%20labels%3D%7B'avg_expr_level'%3A%20'Mean%20Expression%20Level'%7D%2C%0A%20%20%20%20%20%20%20%20color%3D'avg_expr_level'%20%20%23%20Optional%3A%20color%20for%20better%20visualization%0A%20%20%20%20%20%20%20%20).update_layout(xaxis_tickangle%3D-45)%0A%20%20%20%20)%0A%0A%20%20%20%20%23%20Rotate%20x-axis%20labels%20for%20better%20visibility%0A%20%20%20%20fig2%0A%20%20%20%20return%20average2%2C%20fig2%2C%20plot2_df%2C%20plot_genes%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(pd%2C%20plot2_df%2C%20plot_df)%3A%0A%20%20%20%20plot_df.reset_index(drop%3DTrue%2Cinplace%3DTrue)%0A%20%20%20%20plot_df.rename(columns%3D%7B'avg_expr_level'%3A'normal_avg_expr_level'%7D%2C%20inplace%3DTrue)%0A%20%20%20%20plot2_df.reset_index(drop%3DTrue%2Cinplace%3DTrue)%0A%20%20%20%20plot2_df.rename(columns%3D%7B'avg_expr_level'%3A'malignant_avg_expr_level'%7D%2C%20inplace%3DTrue)%0A%20%20%20%20merged_df%3Dpd.merge(plot_df%2C%20plot2_df%2C%20on%3D'Genes')%0A%20%20%20%20merged_df%5B'Mean_Expression_absolute_diff'%5D%3Dabs(merged_df%5B'normal_avg_expr_level'%5D%20-%20merged_df%5B'malignant_avg_expr_level'%5D)%0A%20%20%20%20merged_df%3Dmerged_df.sort_values(by%3D'Mean_Expression_absolute_diff'%2C%20ascending%3DFalse)%0A%20%20%20%20merged_df.head(30)%0A%20%20%20%20return%20(merged_df%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20%23%23%3Cspan%20style%3D%22color%3A%20brown%22%3EAnalysis%20of%20biomarkers%20of%20breast%20cancers%20usting%20AHP%3C%2Fspan%3E%0A%0A%20%20%20%20%20%20%20%20**The%20Cancer%20Biomarkers**%20are%20biological%20molecules%20that%20indicate%20the%20presence%20of%20cancer%20or%20abnormal%20cell%20processes.%20They%20can%20be%20found%20in%20blood%2C%20urine%2C%20tissue%2C%20or%20other%20bodily%20fluids.%20We%20are%20studying%20this%20by%20analysing%20the%20gene%20expressions%20of%20healthy%20and%20cancerous%20samples.%20To%20achive%20this%2C%20we%20are%20using%20%3Cspan%20style%3D%22color%3A%20green%22%3EAnalatical%20Hiracial%20Process%3C%2Fspan%3E.%20%0A%0A%20%20%20%20%20%20%20%20The%20Analytic%20Hierarchy%20Process%20(AHP)%20is%20a%20structured%20decision-making%20approach%20that%20helps%20prioritize%20and%20select%20the%20most%20important%20criteria%20in%20complex%20problems.%20It%20works%20by%20breaking%20a%20problem%20into%20a%20hierarchy%20of%20criteria%20and%20sub-criteria%2C%20assigning%20numerical%20values%20to%20their%20relative%20importance%2C%20and%20using%20pairwise%20comparisons%20to%20generate%20a%20weighted%20ranking.%20Traditional%20AHP%20is%20often%20qualitative%2C%20relying%20on%20expert%20judgment%2C%20but%20in%20bioinformatics%2C%20a%20modified%20AHP%20can%20integrate%20statistical%20methods%20to%20enhance%20objectivity.%0A%0A%0A%20%20%20%20%20%20%20%20In%20the%20context%20of%20biomarker%20analysis%20for%20BRCA-related%20research%2C%20AHP%20can%20significantly%20improve%20the%20selection%20of%20key%20biomarkers%20by%20aggregating%20multiple%20statistical%20gene%20selection%20methods.%20Instead%20of%20relying%20on%20a%20single%20metric%2C%20such%20as%20a%20t-test%20or%20entropy%2C%20the%20modified%20AHP%20integrates%20multiple%20ranking%20criteria%20(e.g.%2C%20Wilcoxon%20test%2C%20ROC%20curves%2C%20signal-to-noise%20ratio)%20to%20create%20a%20more%20stable%20and%20reliable%20subset%20of%20genes.%20This%20method%20ensures%20that%20the%20chosen%20biomarkers%20are%20not%20only%20statistically%20significant%20but%20also%20robust%20across%20different%20datasets%20and%20ranking%20approaches.%20By%20identifying%20the%20most%20influential%20genes%20systematically%2C%20AHP%20helps%20refine%20the%20list%20of%20biomarkers%20that%20could%20be%20further%20analyzed%20for%20their%20role%20in%20breast%20cancer%20progression%2C%20prognosis%2C%20or%20response%20to%20treatment.%0A%0A%20%20%20%20%20%20%20%20%3Cspan%20style%3D%22color%3A%20green%22%3EModified%20AHP%3A%3C%2Fspan%3E%0A%0A%20%20%20%20%20%20%20%20*%20%3Cspan%20style%3D%22color%3A%20green%22%3ETwo-Sample%20t-Test%3A%3C%2Fspan%3E%0A%0A%20%20%20%20%20%20%20%20Purpose%3A%20Identifies%20statistically%20significant%20differences%20in%20gene%20expression%20between%20two%20groups%20(e.g.%2C%20cancerous%20vs.%20healthy%20cells).%0A%0A%20%20%20%20%20%20%20%20Method%3A%20Compares%20the%20means%20of%20two%20independent%20samples%20using%20the%20t-statistic.%0A%0A%20%20%20%20%20%20%20%20Output%3A%20A%20t-score%20and%20p-value.%20A%20small%20p-value%20indicates%20significant%20differences%20in%20expression.%0A%0A%20%20%20%20%20%20%20%20*%20%3Cspan%20style%3D%22color%3A%20green%22%3EEntropy%20Test%3A%3C%2Fspan%3E%0A%0A%20%20%20%20%20%20%20%20Purpose%3A%20Measures%20the%20disorder%20in%20gene%20expression%20levels.%0A%0A%20%20%20%20%20%20%20%20Method%3A%20Computes%20entropy%20using%20histogram-based%20probability%20distributions.%0A%0A%20%20%20%20%20%20%20%20Output%3A%20Higher%20entropy%20values%20indicate%20genes%20with%20more%20variability%2C%20which%20are%20more%20useful%20for%20classification.%0A%0A%20%20%20%20%20%20%20%20*%20%3Cspan%20style%3D%22color%3A%20green%22%3EWilcoxon%20Rank-Sum%20Test%3A%3C%2Fspan%3E%0A%0A%20%20%20%20%20%20%20%20Purpose%3A%20A%20non-parametric%20test%20used%20to%20rank%20genes%20based%20on%20their%20median%20expression%20differences.%0A%0A%20%20%20%20%20%20%20%20Method%3A%20Compares%20the%20ranks%20of%20two%20independent%20samples%20instead%20of%20their%20means.%0A%0A%20%20%20%20%20%20%20%20Output%3A%20A%20Wilcoxon%20statistic%20and%20a%20p-value.%20A%20low%20p-value%20suggests%20significant%20differences%20in%20gene%20ranks.%0A%0A%20%20%20%20%20%20%20%20*%20%3Cspan%20style%3D%22color%3A%20green%22%3ESignal-to-Noise%20Ratio%20(SNR)%3A%3C%2Fspan%3E%0A%0A%20%20%20%20%20%20%20%20Purpose%3A%20Compares%20the%20difference%20in%20mean%20expression%20levels%20relative%20to%20the%20standard%20deviation.%0A%0A%20%20%20%20%20%20%20%20Method%3A%20SNR%20is%20calculated%20as%20the%20difference%20between%20the%20means%20of%20two%20groups%20divided%20by%20the%20sum%20of%20their%20standard%20deviations.%0A%0A%20%20%20%20%20%20%20%20Output%3A%20A%20higher%20SNR%20suggests%20that%20the%20gene%20has%20a%20strong%20discriminatory%20power%20between%20groups.%0A%0A%20%20%20%20%20%20%20%20*%20%3Cspan%20style%3D%22color%3A%20green%22%3EAHP%20Weighted%20Ranking%3A%3C%2Fspan%3E%0A%0A%20%20%20%20%20%20%20%20Purpose%3A%20Integrates%20statistical%20measures%20into%20a%20single%20weighted%20ranking%20system%20to%20prioritize%20significant%20genes.%0A%0A%20%20%20%20%20%20%20%20Method%3A%20Normalizes%20scores%20across%20all%20statistical%20tests%20and%20applies%20predefined%20weights.%0A%0A%20%20%20%20%20%20%20%20Output%3A%20A%20final%20ranking%20score%20indicating%20the%20importance%20of%20each%20gene%20in%20classification.%0A%0A%20%20%20%20%20%20%20%20*%20%3Cspan%20style%3D%22color%3A%20green%22%3E%20Eigenvalues%20and%20Eigenvectors%20in%20Gene%20Selection%20(Modified%20AHP)%3A%20%3C%2Fspan%3E%0A%0A%20%20%20%20%20%20%20%20The%20modified%20Analytic%20Hierarchy%20Process%20(AHP)%20used%20for%20gene%20selection%20involves%20constructing%20a%20pairwise%20comparison%20matrix%20where%20genes%20are%20ranked%20based%20on%20multiple%20statistical%20criteria%20(e.g.%2C%20t-test%2C%20entropy%2C%20ROC%2C%20Wilcoxon%2C%20and%20SNR).%0A%0A%20%20%20%20%20%20%20%20The%20matrix%20is%20required%20to%20be%20consistent%2C%20meaning%20that%20its%20elements%20must%20satisfy%20certain%20transitivity%20properties.%0A%20%20%20%20%20%20%20%20Eigenvectors%20are%20computed%20from%20this%20matrix%20to%20obtain%20ranking%20scores%20of%20genes.%20These%20eigenvectors%20correspond%20to%20the%20principal%20components%20that%20define%20the%20most%20discriminative%20genes.%0A%0A%20%20%20%20%20%20%20%20The%20largest%20eigenvalue%20(%F0%9D%9C%86%F0%9D%91%9A%F0%9D%91%8E%F0%9D%91%A5)%20is%20used%20to%20compute%20the%20Consistency%20Index%20(CI)%20and%20Consistency%20Ratio%20(CR)%20to%20ensure%20that%20the%20ranking%20process%20is%20mathematically%20sound.%0A%20%20%20%20%20%20%20%20Eigenvalues%20and%20Eigenvectors%20in%20HMMs%3A%0A%0A%20%20%20%20%20%20%20%20HMMs%20use%20transition%20probability%20matrices%20to%20model%20state%20changes%20in%20gene%20expression%20related%20to%20cancer%20progression.%0A%20%20%20%20%20%20%20%20The%20transition%20probability%20matrix%20(A)%20is%20a%20stochastic%20matrix%20that%20describes%20the%20likelihood%20of%20transitioning%20from%20one%20state%20to%20another.%0A%0A%20%20%20%20%20%20%20%20The%20stationary%20distribution%20of%20states%20(long-term%20probabilities%20of%20each%20state)%20is%20found%20by%20computing%20the%20dominant%20eigenvector%20(associated%20with%20eigenvalue%201)%20of%20this%20matrix.%0A%0A%20%20%20%20%20%20%20%20Spectral%20analysis%20(using%20eigenvalues)%20helps%20determine%20the%20stability%20and%20convergence%20properties%20of%20the%20HMM.%0A%20%20%20%20%20%20%20%20Why%20This%20Matters%20for%20Cancer%20Classification%0A%0A%20%20%20%20%20%20%20%20Gene%20Selection%20(AHP%20with%20Eigenvectors)%20ensures%20that%20the%20most%20informative%20genes%20are%20chosen%20based%20on%20multiple%20criteria%2C%20improving%20classification%20accuracy.%0A%0A%20%20%20%20%20%20%20%20HMMs%20with%20Eigenvalues%20provide%20a%20probabilistic%20framework%20to%20model%20cancer%20progression%20and%20classify%20gene%20expression%20data%20efficiently.%0A%0A%20%20%20%20%20%20%20%20Eigenvectors%20define%20important%20features%2C%20helping%20reduce%20computational%20complexity%20and%20improving%20stability.%0A%0A%0A%20%20%20%20%20%20%20%20%3Cspan%20style%3D%22color%3A%20brown%22%3EPlease%20run%20%5BcomputeAhp.py%5D(https%3A%2F%2Fgithub.com%2FANikfarjam%2FGeneScope)%20to%20calculate%20the%20ahp%20scores!%3C%2Fspan%3E%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20%23%20**Pairwise%20Comparison%20Matrix%20and%20Eigenvalues%20in%20Modified%20AHP**%0A%0A%20%20%20%20%20%20%20%20The%20article%20describes%20the%20calculation%20of%20the%20**pairwise%20comparison%20matrix**%20and%20the%20**eigenvalues%20and%20eigenvectors**%20in%20the%20context%20of%20the%20**modified%20Analytic%20Hierarchy%20Process%20(AHP)**%20used%20for%20gene%20selection.%0A%0A%20%20%20%20%20%20%20%20%23%23%20**1.%20Construction%20of%20the%20Pairwise%20Comparison%20Matrix**%0A%20%20%20%20%20%20%20%20The%20pairwise%20comparison%20matrix%20%24X%20%3D%20(x_%7Bij%7D)%24%20is%20an%20%24n%20%5Ctimes%20n%24%20matrix%2C%20where%20each%20element%20%24x_%7Bij%7D%24%20represents%20the%20relative%20importance%20of%20gene%20%24i%24%20compared%20to%20gene%20%24j%24.%20The%20matrix%20satisfies%3A%0A%0A%20%20%20%20%20%20%20%20%24%24%0A%20%20%20%20%20%20%20%20x_%7Bij%7D%20%3D%20%5Cfrac%7B1%7D%7Bx_%7Bji%7D%7D%2C%20%5Cquad%20%5Cforall%20i%20%5Cneq%20j%0A%20%20%20%20%20%20%20%20%24%24%0A%0A%20%20%20%20%20%20%20%20%24%24%0A%20%20%20%20%20%20%20%20x_%7Bii%7D%20%3D%201%2C%20%5Cquad%20%5Cforall%20i%0A%20%20%20%20%20%20%20%20%24%24%0A%0A%20%20%20%20%20%20%20%20The%20elements%20of%20the%20matrix%20are%20computed%20based%20on%20**quantitative%20criteria**%2C%20which%20include%3A%0A%20%20%20%20%20%20%20%20-%20**t-test**%0A%20%20%20%20%20%20%20%20-%20**Entropy**%0A%20%20%20%20%20%20%20%20-%20**Receiver%20Operating%20Characteristic%20(ROC)%20curve**%0A%20%20%20%20%20%20%20%20-%20**Wilcoxon%20test**%0A%20%20%20%20%20%20%20%20-%20**Signal-to-Noise%20Ratio%20(SNR)**%0A%0A%20%20%20%20%20%20%20%20The%20absolute%20difference%20between%20the%20statistical%20values%20of%20two%20genes%20%24i%24%20and%20%24j%24%20is%20used%20to%20compute%20the%20pairwise%20importance%20score%3A%0A%0A%20%20%20%20%20%20%20%20%24%24%0A%20%20%20%20%20%20%20%20d_%7Bij%7D%20%3D%20%7Cc_i%20-%20c_j%7C%0A%20%20%20%20%20%20%20%20%24%24%0A%0A%20%20%20%20%20%20%20%20where%20%24c_i%24%20and%20%24c_j%24%20are%20the%20scores%20of%20genes%20%24i%24%20and%20%24j%24%20under%20the%20given%20criterion.%20The%20final%20matrix%20values%20are%20scaled%20within%20the%20range%20**%5B1%2C10%5D**%20using%3A%0A%0A%20%20%20%20%20%20%20%20%24%24%0A%20%20%20%20%20%20%20%20c%20%3D%20%5Cfrac%7Bd_%7Bij%7D%20-%209%7D%7Bc_%7B%5Cmax%7D%7D%20%2B%201%0A%20%20%20%20%20%20%20%20%24%24%0A%0A%20%20%20%20%20%20%20%20%24%24%0A%20%20%20%20%20%20%20%20x_%7Bij%7D%20%3D%0A%20%20%20%20%20%20%20%20%5Cbegin%7Bcases%7D%20%0A%20%20%20%20%20%20%20%20c%2C%20%26%20%5Ctext%7Bif%20%7D%20c_i%20%5Cgeq%20c_j%20%5C%5C%0A%20%20%20%20%20%20%20%20%5Cfrac%7B1%7D%7Bc%7D%2C%20%26%20%5Ctext%7Botherwise%7D%0A%20%20%20%20%20%20%20%20%5Cend%7Bcases%7D%0A%20%20%20%20%20%20%20%20%24%24%0A%0A%20%20%20%20%20%20%20%20where%20%24c_%7B%5Cmax%7D%24%20is%20the%20maximum%20distance%20between%20genes.%0A%0A%20%20%20%20%20%20%20%20%23%23%20**2.%20Eigenvector%20Calculation%20(Ranking%20Genes)**%0A%20%20%20%20%20%20%20%20Once%20the%20pairwise%20comparison%20matrix%20is%20constructed%2C%20**eigenvectors**%20are%20used%20to%20determine%20the%20ranking%20of%20genes.%20The%20eigenvector%20%24%5Clambda%24%20is%20computed%20using%3A%0A%0A%20%20%20%20%20%20%20%20%24%24%0A%20%20%20%20%20%20%20%20S_j%20%3D%20%5Csum_%7Bi%3D1%7D%5E%7Bn%7D%20x_%7Bij%7D%0A%20%20%20%20%20%20%20%20%24%24%0A%0A%20%20%20%20%20%20%20%20%24%24%0A%20%20%20%20%20%20%20%20%5Clambda_i%20%3D%20%5Cfrac%7B1%7D%7Bn%7D%20%5Csum_%7Bj%3D1%7D%5E%7Bn%7D%20%5Cfrac%7Bx_%7Bij%7D%7D%7BS_j%7D%0A%20%20%20%20%20%20%20%20%24%24%0A%0A%20%20%20%20%20%20%20%20This%20**normalized%20eigenvector**%20represents%20the%20ranking%20of%20genes.%0A%0A%20%20%20%20%20%20%20%20%23%23%20**3.%20Eigenvalue%20Calculation%20and%20Consistency%20Check**%0A%20%20%20%20%20%20%20%20The%20largest%20eigenvalue%20%24%5Clambda_%7B%5Cmax%7D%24%20is%20estimated%20as%3A%0A%0A%20%20%20%20%20%20%20%20%24%24%0A%20%20%20%20%20%20%20%20%5Clambda_%7B%5Cmax%7D%20%3D%20%5Cfrac%7B1%7D%7B%5Clambda_i%7D%20%5Csum_%7Bj%3D1%7D%5E%7Bn%7D%20x_%7Bij%7D%20%5Clambda_j%0A%20%20%20%20%20%20%20%20%24%24%0A%0A%20%20%20%20%20%20%20%20The%20**Consistency%20Index%20(CI)**%20is%20given%20by%3A%0A%0A%20%20%20%20%20%20%20%20%24%24%0A%20%20%20%20%20%20%20%20CI%20%3D%20%5Cfrac%7B%5Clambda_%7B%5Cmax%7D%20-%20n%7D%7Bn-1%7D%0A%20%20%20%20%20%20%20%20%24%24%0A%0A%20%20%20%20%20%20%20%20The%20**Consistency%20Ratio%20(CR)**%20is%20then%20computed%20using%20a%20**Random%20Index%20(RI)**%3A%0A%0A%20%20%20%20%20%20%20%20%24%24%0A%20%20%20%20%20%20%20%20CR%20%3D%20%5Cfrac%7BCI%7D%7BRI%7D%0A%20%20%20%20%20%20%20%20%24%24%0A%0A%20%20%20%20%20%20%20%20A%20**CR%20value%20%E2%89%A4%200.1**%20indicates%20an%20acceptable%20consistency%20level.%0A%0A%20%20%20%20%20%20%20%20%23%23%20**Summary**%0A%20%20%20%20%20%20%20%20-%20The%20pairwise%20comparison%20matrix%20is%20built%20using%20**quantitative%20ranking**%20instead%20of%20expert%20judgment.%0A%20%20%20%20%20%20%20%20-%20The%20eigenvector%20of%20the%20matrix%20determines%20the%20relative%20ranking%20of%20genes.%0A%20%20%20%20%20%20%20%20-%20The%20eigenvalue%20and%20consistency%20ratio%20ensure%20that%20the%20matrix%20is%20valid%20for%20decision-making.%0A%0A%20%20%20%20%20%20%20%20This%20method%20ensures%20an%20**objective**%20and%20**stable**%20way%20to%20rank%20genes%2C%20which%20improves%20classification%20accuracy%20in%20cancer%20detection%20using%20**Hidden%20Markov%20Models%20(HMMs)**.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(mo)%3A%0A%20%20%20%20mo.image('AHPexplnation.png'%2C%20caption%3D'The%20hierarchy%20of%20factors%20for%20gene%20selection%20by%20AHP.')%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(pd)%3A%0A%20%20%20%20ahp_df%3D%20pd.read_csv('Mod_ahp_scores.csv')%0A%20%20%20%20%23%20mo.ui.table(ahp_df.sort_values(by%3D'Scores'%2C%20ascending%3DFalse))%0A%20%20%20%20return%20(ahp_df%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(ahp_df%2C%20mo)%3A%0A%20%20%20%20import%20altair%20as%20alt%0A%20%20%20%20%23%20Ensure%20Altair%20handles%20large%20datasets%0A%20%20%20%20alt.data_transformers.enable(%22vegafusion%22)%0A%20%20%20%20%23%20Sort%20and%20take%20top%20300%20genes%0A%20%20%20%20ahp_top%20%3D%20ahp_df.sort_values(by%3D'Scores'%2C%20ascending%3DFalse).iloc%5B%3A1000%2C%3A%5D%0A%0A%20%20%20%20%23%20Ensure%20%22Gene%22%20column%20is%20retained%20and%20treated%20as%20string%0A%20%20%20%20ahp_top_scaled%20%3D%20ahp_top.copy()%0A%20%20%20%20ahp_top_scaled.iloc%5B%3A%2C%201%3A%5D%20*%3D%201e6%20%20%23%20Apply%20scaling%0A%20%20%20%20ahp_top_scaled%5B'Gene'%5D%20%3D%20ahp_top_scaled%5B'Gene'%5D.astype(str)%0A%0A%20%20%20%20%23%20Selection%20for%20interactive%20brushing%0A%20%20%20%20brush%20%3D%20alt.selection_interval(encodings%3D%5B'x'%2C%20'y'%5D)%0A%0A%20%20%20%20%23%20Scatter%20Plot%20(Interactive)%0A%20%20%20%20scatter%20%3D%20alt.Chart(ahp_top_scaled).mark_circle(size%3D60).encode(%0A%20%20%20%20%20%20%20%20x%3D'Scores%3AQ'%2C%0A%20%20%20%20%20%20%20%20y%3D't_test%3AQ'%2C%0A%20%20%20%20%20%20%20%20tooltip%3D%5B'Gene%3AN'%2C%20'Scores%3AQ'%2C%20't_test%3AQ'%2C%20'entropy%3AQ'%2C%20'roc_auc%3AQ'%2C%20'snr%3AQ'%5D%2C%0A%20%20%20%20%20%20%20%20color%3Dalt.condition(brush%2C%20alt.value('steelblue')%2C%20alt.value('lightgray'))%0A%20%20%20%20).add_params(brush).properties(%0A%20%20%20%20%20%20%20%20width%3D700%2C%0A%20%20%20%20%20%20%20%20height%3D400%2C%0A%20%20%20%20%20%20%20%20title%3D%22Gene%20Scores%20vs.%20t-test%22%0A%20%20%20%20)%0A%0A%20%20%20%20%23%20Get%20top%2010%20genes%20for%20default%20view%0A%20%20%20%20top_10_genes%20%3D%20ahp_top_scaled.nlargest(10%2C%20'Scores')%0A%0A%20%20%20%20plot_to_show%20%3D%20top_10_genes%20if%20not%20brush%20else%20ahp_top_scaled%0A%20%20%20%20%23%20Bar%20Chart%20(t_test%20%26%20entropy)%20with%20only%20top%2010%20genes%20before%20selection%0A%20%20%20%20bar%20%3D%20(%0A%20%20%20%20%20%20%20%20alt.Chart(ahp_top_scaled)%0A%20%20%20%20%20%20%20%20.transform_fold(%5B't_test'%2C%20'entropy'%5D%2C%20as_%3D%5B'Metric'%2C%20'Value'%5D)%0A%20%20%20%20%20%20%20%20.mark_bar()%0A%20%20%20%20%20%20%20%20.encode(%0A%20%20%20%20%20%20%20%20%20%20%20%20x%3Dalt.X('Gene%3AN'%2C%20sort%3D'-y')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20y%3Dalt.Y('Value%3AQ')%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20color%3D'Metric%3AN'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20tooltip%3D%5B'Gene%3AN'%2C%20'Metric%3AN'%2C%20'Value%3AQ'%5D%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20.transform_filter(%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20Show%20any%20gene%20that%20the%20brush%20has%20selected%20(brush)%0A%20%20%20%20%20%20%20%20%20%20%20%20%23%20OR%20any%20gene%20in%20the%20top%2010%20(FieldOneOfPredicate)%0A%20%20%20%20%20%20%20%20%20%20%20%20brush%20%7C%20alt.FieldOneOfPredicate(field%3D'Gene'%2C%20oneOf%3Dtop_10_genes%5B'Gene'%5D.tolist())%0A%20%20%20%20%20%20%20%20)%0A%20%20%20%20%20%20%20%20.properties(width%3D700%2C%20height%3D200%2C%20title%3D%22t_test%20%26%20Entropy%20for%20Selected%20Genes%22)%0A%20%20%20%20)%0A%0A%20%20%20%20%23%20Table%20that%20dynamically%20updates%20on%20selection%0A%0A%20%20%20%20def%20gene_table()%3A%0A%20%20%20%20%20%20%20%20selected_genes%20%3D%20ahp_top_scaled.loc%5Bahp_top_scaled%5B'Gene'%5D.isin(top_10_genes%5B'Gene'%5D)%5D%0A%0A%20%20%20%20%20%20%20%20if%20not%20brush.empty%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20selected_genes%20%3D%20ahp_top_scaled%20%20%23%20Show%20selected%20genes%20when%20brush%20is%20used%0A%0A%20%20%20%20%20%20%20%20return%20mo.ui.table(selected_genes)%0A%0A%20%20%20%20table%20%3D%20gene_table()%0A%0A%20%20%20%20%23%20Combine%20all%20charts%20and%20table%0A%20%20%20%20interactive_chart%20%3D%20alt.vconcat(scatter%2C%20bar)%0A%20%20%20%20mo.vstack(%5Binteractive_chart%2C%20table%5D)%0A%20%20%20%20return%20(%0A%20%20%20%20%20%20%20%20ahp_top%2C%0A%20%20%20%20%20%20%20%20ahp_top_scaled%2C%0A%20%20%20%20%20%20%20%20alt%2C%0A%20%20%20%20%20%20%20%20bar%2C%0A%20%20%20%20%20%20%20%20brush%2C%0A%20%20%20%20%20%20%20%20gene_table%2C%0A%20%20%20%20%20%20%20%20interactive_chart%2C%0A%20%20%20%20%20%20%20%20plot_to_show%2C%0A%20%20%20%20%20%20%20%20scatter%2C%0A%20%20%20%20%20%20%20%20table%2C%0A%20%20%20%20%20%20%20%20top_10_genes%2C%0A%20%20%20%20)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%22%22%22%23%23%20%3Cspan%20style%3D%22color%3A%20green%22%3EPairWize%20MAtrix%20Visualization%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_()%3A%0A%20%20%20%20import%20pickle%0A%20%20%20%20%23%20from%20scipy.sparse%20import%20csr_matrix%0A%20%20%20%20%23%20%23%20Open%20the%20large%20Pickle%20file%20without%20fully%20loading%20it%0A%20%20%20%20%23%20with%20open(%22pwm_pickl.pkl%22%2C%20%22rb%22)%20as%20f%3A%0A%20%20%20%20%23%20%20%20%20%20while%20True%3A%0A%20%20%20%20%23%20%20%20%20%20%20%20%20%20try%3A%0A%20%20%20%20%23%20%20%20%20%20%20%20%20%20%20%20%20%20pwm_chunk%20%3D%20pickle.load(f)%20%20%23%20Load%20one%20pairwise%20matrix%20at%20a%20time%0A%20%20%20%20%23%20%20%20%20%20%20%20%20%20%20%20%20%20for%20key%2C%20sparse_matrix%20in%20pwm_chunk.items()%3A%0A%20%20%20%20%23%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20print(f%22Processing%20sparse%20matrix%20for%3A%20%7Bkey%7D%22)%0A%20%20%20%20%23%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20sparse_matrix%20%3D%20csr_matrix(sparse_matrix)%20%20%23%20Convert%20if%20necessary%0A%20%20%20%20%23%20%20%20%20%20%20%20%20%20except%20EOFError%3A%0A%20%20%20%20%23%20%20%20%20%20%20%20%20%20%20%20%20%20break%20%20%23%20Stop%20when%20end%20of%20file%20is%20reached%0A%20%20%20%20with%20open(%22pwm_pickl.pkl%22%2C%20%22rb%22)%20as%20fs%3A%0A%20%20%20%20%20%20%20%20pwm%20%3D%20pickle.load(fs)%0A%20%20%20%20%20%20%20%20print(pwm.keys())%0A%20%20%20%20%20%20%20%20%23't_test'%2C%20'entropy'%2C%20'roc_auc'%2C%20'snr%0A%20%20%20%20%20%20%20%20t_test_matrix%20%3D%20pwm%5B't_test'%5D%0A%20%20%20%20%20%20%20%20entropy_matrix%20%3D%20pwm%5B'entropy'%5D%0A%20%20%20%20%20%20%20%20roc_matrix%20%3D%20pwm%5B'roc_auc'%5D%0A%20%20%20%20%20%20%20%20snr_matrix%20%3D%20pwm%5B'snr'%5D%0A%20%20%20%20return%20(%0A%20%20%20%20%20%20%20%20entropy_matrix%2C%0A%20%20%20%20%20%20%20%20fs%2C%0A%20%20%20%20%20%20%20%20pickle%2C%0A%20%20%20%20%20%20%20%20pwm%2C%0A%20%20%20%20%20%20%20%20roc_matrix%2C%0A%20%20%20%20%20%20%20%20snr_matrix%2C%0A%20%20%20%20%20%20%20%20t_test_matrix%2C%0A%20%20%20%20)%0A%0A%0A%40app.cell%0Adef%20_(%0A%20%20%20%20ahp_df%2C%0A%20%20%20%20ahp_top%2C%0A%20%20%20%20entropy_matrix%2C%0A%20%20%20%20mo%2C%0A%20%20%20%20pd%2C%0A%20%20%20%20px%2C%0A%20%20%20%20roc_matrix%2C%0A%20%20%20%20snr_matrix%2C%0A%20%20%20%20t_test_matrix%2C%0A)%3A%0A%20%20%20%20%23%20Convert%20sparse%20matrix%20to%20dense%20format%0A%20%20%20%20t_test_dense_matrix%20%3D%20t_test_matrix.toarray()%20%20%23%20Convert%20sparse%20to%20dense%20numpy%20array%0A%20%20%20%20entropy_dense_matrix%20%3D%20entropy_matrix.toarray()%0A%20%20%20%20roc_dense_matrix%20%3D%20roc_matrix.toarray()%0A%20%20%20%20snr_dense_matrix%20%3D%20snr_matrix.toarray()%0A%20%20%20%20%23%20top%20genes%20%0A%20%20%20%20top_genes%20%3D%20ahp_top.Gene.tolist()%5B%3A101%5D%0A%20%20%20%20%23%20Create%20a%20DataFrame%20with%20gene%20names%20as%20both%20index%20and%20columns%0A%20%20%20%20t_test_pairwise_df%20%3D%20pd.DataFrame(t_test_dense_matrix%2C%20index%3Dahp_df.Gene%2C%20columns%3Dahp_df.Gene).loc%5Btop_genes%2C%20top_genes%5D%0A%20%20%20%20entropy_pairwise_df%20%3D%20pd.DataFrame(entropy_dense_matrix%2C%20index%3Dahp_df.Gene%2C%20columns%3Dahp_df.Gene).loc%5Btop_genes%2C%20top_genes%5D%0A%20%20%20%20roc_pairwise_df%20%3D%20pd.DataFrame(roc_dense_matrix%2C%20index%3Dahp_df.Gene%2C%20columns%3Dahp_df.Gene).loc%5Btop_genes%2C%20top_genes%5D%0A%20%20%20%20snr_pairwise_df%20%3D%20pd.DataFrame(snr_dense_matrix%2C%20index%3Dahp_df.Gene%2C%20columns%3Dahp_df.Gene).loc%5Btop_genes%2C%20top_genes%5D%0A%0A%20%20%20%20%23%20Replace%20NaN%20values%20(if%20any)%20with%200%0A%20%20%20%20def%20creat_heatmap(df)%3A%0A%20%20%20%20%20%20%20%20fig%20%3D%20px.imshow(df)%0A%20%20%20%20%20%20%20%20return%20mo.ui.plotly(fig)%0A%20%20%20%20mo.ui.tabs(%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%20%20%22T_Test%22%3A%20mo.vstack(%5Bcreat_heatmap(t_test_pairwise_df)%2C%20mo.ui.table(t_test_pairwise_df)%5D)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22Entropy%22%3A%20mo.vstack(%5Bcreat_heatmap(entropy_pairwise_df)%2C%20mo.ui.table(entropy_pairwise_df)%5D)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22ROC%22%3A%20mo.vstack(%5Bcreat_heatmap(roc_pairwise_df)%2C%20mo.ui.table(roc_pairwise_df)%5D)%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%22SNR%22%3A%20mo.vstack(%5Bcreat_heatmap(snr_pairwise_df)%2C%20mo.ui.table(snr_pairwise_df)%5D)%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20)%0A%20%20%20%20return%20(%0A%20%20%20%20%20%20%20%20creat_heatmap%2C%0A%20%20%20%20%20%20%20%20entropy_dense_matrix%2C%0A%20%20%20%20%20%20%20%20entropy_pairwise_df%2C%0A%20%20%20%20%20%20%20%20roc_dense_matrix%2C%0A%20%20%20%20%20%20%20%20roc_pairwise_df%2C%0A%20%20%20%20%20%20%20%20snr_dense_matrix%2C%0A%20%20%20%20%20%20%20%20snr_pairwise_df%2C%0A%20%20%20%20%20%20%20%20t_test_dense_matrix%2C%0A%20%20%20%20%20%20%20%20t_test_pairwise_df%2C%0A%20%20%20%20%20%20%20%20top_genes%2C%0A%20%20%20%20)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20%23%23%3Cspan%20style%3D%22color%3A%20brown%22%3EClinical_Variables%20Suplemantory%20file%3A%3Cspan%3E%0A%0A%20%20%20%20%20%20%20%20This%20suplementary%20file%20gives%20cancer%20related%20senses%20such%20as%20**age%2C%20gender%2C%20tebaco%20and%20alchohol%20consumption%2C%20and%20family%20historyy%2C%20...**.%0A%0A%20%20%20%20%20%20%20%20we%20need%20to%20analy%20how%20does%20each%20of%20these%20corolates%20with%20the%20cancer%20status.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo%2C%20pd)%3A%0A%20%20%20%20with%20open('..%2F..%2Fdata%2FSuplementoryFiles%2FGSE62944_01_27_15_TCGA_20_420_Clinical_Variables_7706_Samples.txt'%2C%20'r')%20as%20file%3A%0A%20%20%20%20%20%20%20%20exractedData1%3D%5Bline.split('%5Ct')%20for%20line%20in%20file.readlines()%5D%0A%20%20%20%20with%20open('..%2F..%2Fdata%2FSuplementoryFiles%2FGSE62944_06_01_15_TCGA_24_548_Clinical_Variables_9264_Samples.txt'%2C%20'r')%20as%20file%3A%0A%20%20%20%20%20%20%20%20exractedData2%3D%5Bline.split('%5Ct')%20for%20line%20in%20file.readlines()%5D%0A%0A%20%20%20%20%23%20Convert%20to%20DataFrames%0A%20%20%20%20df1%20%3D%20pd.DataFrame(exractedData1)%0A%20%20%20%20df2%20%3D%20pd.DataFrame(exractedData2)%0A%0A%20%20%20%20%23%20Transpose%20the%20DataFrames%0A%20%20%20%20df1%20%3D%20df1.T%0A%20%20%20%20df2%20%3D%20df2.T%0A%0A%20%20%20%20%23%20Concatenate%0A%20%20%20%20concat_df%20%3D%20pd.concat(%5Bdf1%2C%20df2%5D)%0A%0A%20%20%20%20%23%20Rename%20columns%20using%20the%20first%20row%0A%20%20%20%20concat_df.columns%20%3D%20concat_df.iloc%5B0%5D%0A%20%20%20%20concat_df%20%3D%20concat_df.drop(0)%20%20%23%20Remove%20the%20first%20row%0A%0A%20%20%20%20%23remove%20nan%20colomns%0A%20%20%20%20concat_df%20%3D%20concat_df.loc%5B%3A%2C%20~concat_df.columns.isna()%5D%0A%0A%20%20%20%20%23%20Rename%20index%20column%0A%20%20%20%20if%20''%20in%20concat_df.columns%3A%0A%20%20%20%20%20%20%20%20concat_df.rename(columns%3D%7B''%3A%20'Samples'%7D%2C%20inplace%3DTrue)%0A%0A%20%20%20%20%23%20Display%20the%20DataFrame%0A%20%20%20%20mo.ui.table(concat_df)%0A%20%20%20%20return%20concat_df%2C%20df1%2C%20df2%2C%20exractedData1%2C%20exractedData2%2C%20file%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%22%22%22After%20Creating%20a%20data%20fram%20from%20the%20two%20%3Cspan%20style%3D%22color%3A%20brown%22%3Etwo%20clinical%20suplimentary%20files%3C%2Fspan%3E%2C%20now%20we%20have%20to%20extract%20all%20the%20BRCA%20data%20from%20it%20and%20the%20following%20table%20displays%20all%20the%20brca%20related%20logistics.%20Now%20we%20can%20delve%20in%20furthure%20to%20create%20a%20dataset%20for%20stage%20prognosis%20and%20furthermore%20analyze%20patients%20demografic%20and%20see%20how%20they%20are%20corolated.%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(cancer_dataSet%2C%20concat_df%2C%20healthy_dataSet%2C%20mo)%3A%0A%20%20%20%20healthyBRCAList%20%3D%20healthy_dataSet.index%0A%20%20%20%20cancerBRCAList%20%3D%20cancer_dataSet%5B'Samples'%5D%0A%0A%20%20%20%20BRCA_CV%20%3D%20concat_df%5Bconcat_df%5B'Samples'%5D.isin(healthyBRCAList)%20%7C%20concat_df%5B'Samples'%5D.isin(cancerBRCAList)%5D.copy()%0A%20%20%20%20%23%20BRCA_CV.drop(columns%3D'index'%2C%20inplace%3DTrue)%0A%20%20%20%20mo.ui.table(BRCA_CV)%0A%20%20%20%20return%20BRCA_CV%2C%20cancerBRCAList%2C%20healthyBRCAList%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(BRCA_CV)%3A%0A%20%20%20%20BRCA_CV%5B'tumor_status'%5D.value_counts()%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%22%22%22as%20we%20can%20see%20not%20all%20tumor%20status%20for%20the%20samples%20are%20properly%20labled.%20thus%20we%20are%20going%20to%20relable%20them.%22%22%22)%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(BRCA_CV%2C%20cancerBRCAList%2C%20healthyBRCAList)%3A%0A%20%20%20%20def%20label_sample(samples)%3A%0A%20%20%20%20%20%20%20%20stats_list%3D%5B%5D%0A%20%20%20%20%20%20%20%20for%20smpl%20in%20samples%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20if%20smpl%20in%20healthyBRCAList%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20stats_list.append(%22Normal%22)%0A%20%20%20%20%20%20%20%20%20%20%20%20elif%20smpl%20in%20cancerBRCAList%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20stats_list.append(%22Malignant%22)%0A%20%20%20%20%20%20%20%20%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20stats_list.append(None)%0A%20%20%20%20%20%20%20%20return%20stats_list%0A%20%20%20%20BRCA_CV%5B%22Status%22%5D%20%3D%20label_sample(BRCA_CV%5B'Samples'%5D.tolist())%0A%0A%20%20%20%20BRCA_CV%5B%22Status%22%5D%0A%20%20%20%20return%20(label_sample%2C)%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20%20%20%20%20%23%23%23%3Cspan%20style%3D%22color%3Agreen%22%3EMedical%20Terminalogies%20for%20Cancer%20Staging%3C%2Fspan%3E%0A%0A%20%20%20%20%20%20%20%20**Cancer%20Staging%3A**%0A%0A%20%20%20%20%20%20%20%20Stage%20refers%20to%20the%20extent%20of%20your%20cancer%2C%20such%20as%20how%20large%20the%20tumor%20is%20and%20if%20it%20has%20spread.%20%0A%0A%20%20%20%20%20%20%20%20**Systems%20That%20Describe%20Stage%3A**%0A%0A%20%20%20%20%20%20%20%20There%20are%20many%20staging%20systems.%20Some%2C%20such%20as%20the%20TNM%20staging%20system%2C%20are%20used%20for%20many%20types%20of%20cancer.%20Others%20are%20specific%20to%20a%20particular%20type%20of%20cancer.%20Most%20staging%20systems%20include%20information%20about%20where%20the%20tumor%20is%20located%20in%20the%20body%0A%20%20%20%20%20%20%20%20the%20size%20of%20the%20tumor%20whether%20the%20cancer%20has%20spread%20to%20nearby%20lymph%20nodes%0A%20%20%20%20%20%20%20%20whether%20the%20cancer%20has%20spread%20to%20a%20different%20part%20of%20the%20body%0A%0A%20%20%20%20%20%20%20%20**The%20TNM%20Staging%20System**%0A%0A%20%20%20%20%20%20%20%20The%20TNM%20system%20is%20the%20most%20widely%20used%20cancer%20staging%20system.%20Most%20hospitals%20and%20medical%20centers%20use%20the%20TNM%20system%20as%20their%20main%20method%20for%20cancer%20reporting.%20You%20are%20likely%20to%20see%20your%20cancer%20described%20by%20this%20staging%20system%20in%20your%20pathology%20report%20unless%20there%20is%20a%20different%20staging%20system%20for%20your%20type%20of%20cancer.%20Examples%20of%20cancers%20with%20different%20staging%20systems%20include%20brain%20and%20spinal%20cord%20tumors%20and%20blood%20cancers.%20%0A%0A%20%20%20%20%20%20%20%20In%20the%20TNM%20system%3A%0A%0A%20%20%20%20%20%20%20%20*%20The%20T%20refers%20to%20the%20size%20and%20extent%20of%20the%20main%20tumor.%20The%20main%20tumor%20is%20usually%20called%20the%20primary%20tumor.%0A%20%20%20%20%20%20%20%20*%20The%20N%20refers%20to%20the%20number%20of%20nearby%20lymph%20nodes%20that%20have%20cancer.%0A%20%20%20%20%20%20%20%20*%20The%20M%20refers%20to%20whether%20the%20cancer%20has%20metastasized.%20This%20means%20that%20the%20cancer%20has%20spread%20from%20the%20primary%20tumor%20to%20other%20parts%20of%20the%20body.%0A%20%20%20%20%20%20%20%20*%20When%20your%20cancer%20is%20described%20by%20the%20TNM%20system%2C%20there%20will%20be%20numbers%20after%20each%20letter%20that%20give%20more%20details%20about%20the%20cancer%E2%80%94for%20example%2C%20T1N0MX%20or%20T3N1M0.%20The%20following%20explains%20what%20the%20letters%20and%20numbers%20mean.%0A%0A%20%20%20%20%20%20%20%20Primary%20tumor%20(T)%3A%0A%0A%20%20%20%20%20%20%20%20*%20TX%3A%20Main%20tumor%20cannot%20be%20measured.%0A%20%20%20%20%20%20%20%20*%20T0%3A%20Main%20tumor%20cannot%20be%20found.%0A%20%20%20%20%20%20%20%20*%20T1%2C%20T2%2C%20T3%2C%20T4%3A%20Refers%20to%20the%20size%20and%2For%20extent%20of%20the%20main%20tumor.%20The%20higher%20the%20number%20after%20the%20T%2C%20the%20larger%20the%20tumor%20or%20the%20more%20it%20has%20grown%20into%20nearby%20tissues.%20*%20*%20T's%20may%20be%20further%20divided%20to%20provide%20more%20detail%2C%20such%20as%20T3a%20and%20T3b.%0A%0A%20%20%20%20%20%20%20%20Regional%20lymph%20nodes%20(N)%3A%0A%0A%20%20%20%20%20%20%20%20*%20NX%3A%20Cancer%20in%20nearby%20lymph%20nodes%20cannot%20be%20measured.%0A%20%20%20%20%20%20%20%20*%20N0%3A%20There%20is%20no%20cancer%20in%20nearby%20lymph%20nodes.%0A%20%20%20%20%20%20%20%20*%20N1%2C%20N2%2C%20N3%3A%20Refers%20to%20the%20number%20and%20location%20of%20lymph%20nodes%20that%20contain%20cancer.%20The%20higher%20the%20number%20after%20the%20N%2C%20the%20more%20lymph%20nodes%20that%20contain%20cancer.%0A%0A%20%20%20%20%20%20%20%20Distant%20metastasis%20(M)%0A%0A%20%20%20%20%20%20%20%20*%20MX%3A%20Metastasis%20cannot%20be%20measured.%0A%20%20%20%20%20%20%20%20*%20M0%3A%20Cancer%20has%20not%20spread%20to%20other%20parts%20of%20the%20body.%0A%20%20%20%20%20%20%20%20*%20M1%3A%20Cancer%20has%20spread%20to%20other%20parts%20of%20the%20body.%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.image(src%3D'BRCA_StageGrouping.png'%2C%20caption%3D'From%20AJCC%20cancer%20staging%20manual.%206th%20Edition.%20New%20York%3A%20Springer-Verlag%2C%202002%20with%20permission.')%0A%20%20%20%20return%0A%0A%0A%40app.cell%0Adef%20_(BRCA_CV)%3A%0A%20%20%20%20stage_col%3D%5Bcol%20for%20col%20in%20BRCA_CV.columns%20if%20str.find(col%2C%20'ajcc')%3E%3D0%5D%0A%20%20%20%20%23%20stage_col%0A%20%20%20%20patient_dmg%3D%5B'Samples'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20'age_at_diagnosis'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20'gender'%2C%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20'race'%2C%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20'ethnicity'%2C%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20'family_history_cancer_indicator'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20'family_history_cancer_type'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20'family_history_cancer_relationship'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20'history_other_malignancy'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20'history_neoadjuvant_treatment'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20'history_colon_polyps'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20'clinical_M'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20'clinical_N'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20'clinical_T'%2C%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20'pathologic_M'%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%5D%0A%20%20%20%20return%20patient_dmg%2C%20stage_col%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo%2C%20pd)%3A%0A%20%20%20%20%23%20Function%20to%20create%20tables%20from%20lists%0A%20%20%20%20def%20create_table(data)%3A%0A%20%20%20%20%20%20%20%20df%20%3D%20pd.DataFrame(data%2C%20columns%3D%5B%22Feature%22%2C%20%22Description%22%5D)%0A%20%20%20%20%20%20%20%20return%20mo.ui.table(df)%0A%0A%20%20%20%20%23%20Define%20tables%20for%20each%20category%0A%20%20%20%20patient_demographics_table%20%3D%20create_table(%5B%0A%20%20%20%20%20%20%20%20%5B%22age_at_diagnosis%22%2C%20%22Age%20at%20the%20time%20of%20cancer%20diagnosis%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22gender%22%2C%20%22Gender%20of%20the%20patient%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22race%22%2C%20%22Racial%20background%20of%20the%20patient%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22ethnicity%22%2C%20%22Ethnic%20background%20of%20the%20patient%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22family_history_cancer_indicator%22%2C%20%22Whether%20there%20is%20a%20family%20history%20of%20cancer%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22family_history_cancer_type%22%2C%20%22Type%20of%20cancer%20in%20the%20family%20history%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22family_history_cancer_relationship%22%2C%20%22Relationship%20of%20family%20members%20with%20cancer%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22history_other_malignancy%22%2C%20%22History%20of%20other%20malignancies%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22history_neoadjuvant_treatment%22%2C%20%22Prior%20neoadjuvant%20treatment%20history%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22history_colon_polyps%22%2C%20%22History%20of%20colon%20polyps%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22history_hematologic_disorder%22%2C%20%22History%20of%20hematologic%20disorders%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22history_exposure_leukemogenic_agents%22%2C%20%22Exposure%20to%20leukemogenic%20agents%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22history_chemical_exposure_other%22%2C%20%22Exposure%20to%20other%20chemical%20agents%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22history_radiation_exposure%22%2C%20%22History%20of%20radiation%20exposure%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22history_hormonal_contraceptives_use%22%2C%20%22Use%20of%20hormonal%20contraceptives%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22history_menopausal_hormone_therapy%22%2C%20%22Use%20of%20menopausal%20hormone%20therapy%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22history_tamoxifen_use%22%2C%20%22Use%20of%20tamoxifen%22%5D%0A%20%20%20%20%5D)%0A%0A%20%20%20%20tumor_characteristics_table%20%3D%20create_table(%5B%0A%20%20%20%20%20%20%20%20%5B%22tumor_status%22%2C%20%22Status%20of%20the%20tumor%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22tumor_type%22%2C%20%22Type%20of%20tumor%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22tumor_tissue_site%22%2C%20%22Location%20of%20the%20tumor%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22anatomic_neoplasm_subdivision%22%2C%20%22Anatomical%20subdivision%20of%20the%20tumor%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22clinical_stage%22%2C%20%22Clinical%20stage%20of%20cancer%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22histologic_diagnosis%22%2C%20%22Histologic%20diagnosis%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22histologic_subtype%22%2C%20%22Histologic%20subtype%20of%20the%20tumor%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22neoplasm_histologic_grade%22%2C%20%22Histologic%20grade%20of%20the%20neoplasm%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22tumor_size_width%22%2C%20%22Width%20of%20the%20tumor%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22tumor_grade%22%2C%20%22Grade%20of%20the%20tumor%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22icd_10%22%2C%20%22ICD-10%20classification%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22icd_o_3_histology%22%2C%20%22ICD-O-3%20histologic%20classification%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22icd_o_3_site%22%2C%20%22ICD-O-3%20site%20classification%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22gleason_pattern_primary%22%2C%20%22Primary%20Gleason%20pattern%20(for%20prostate%20cancer)%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22gleason_pattern_secondary%22%2C%20%22Secondary%20Gleason%20pattern%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22gleason_score%22%2C%20%22Overall%20Gleason%20score%22%5D%0A%20%20%20%20%5D)%0A%0A%20%20%20%20cancer_staging_table%20%3D%20create_table(%5B%0A%20%20%20%20%20%20%20%20%5B%22ajcc_staging_edition%22%2C%20%22AJCC%20staging%20edition%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22ajcc_tumor_pathologic_pt%22%2C%20%22Pathologic%20primary%20tumor%20stage%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22ajcc_nodes_pathologic_pn%22%2C%20%22Pathologic%20lymph%20node%20stage%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22ajcc_metastasis_pathologic_pm%22%2C%20%22Pathologic%20metastasis%20stage%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22ajcc_pathologic_tumor_stage%22%2C%20%22Overall%20pathologic%20tumor%20stage%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22ajcc_clinical_tumor_stage%22%2C%20%22Overall%20clinical%20tumor%20stage%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22clinical_M%22%2C%20%22Clinical%20metastasis%20stage%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22clinical_N%22%2C%20%22Clinical%20lymph%20node%20stage%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22clinical_T%22%2C%20%22Clinical%20tumor%20stage%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22pathologic_M%22%2C%20%22Pathologic%20metastasis%20stage%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22pathologic_N%22%2C%20%22Pathologic%20lymph%20node%20stage%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22pathologic_T%22%2C%20%22Pathologic%20tumor%20stage%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22pathologic_stage%22%2C%20%22Overall%20pathologic%20stage%22%5D%0A%20%20%20%20%5D)%0A%0A%20%20%20%20metastasis_table%20%3D%20create_table(%5B%0A%20%20%20%20%20%20%20%20%5B%22metastatic_tumor_indicator%22%2C%20%22Indicates%20metastatic%20tumor%20presence%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22metastasis_site%22%2C%20%22Site%20of%20metastasis%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22extracapsular_extension%22%2C%20%22Presence%20of%20extracapsular%20extension%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22extracapsular_extension_present%22%2C%20%22Whether%20extracapsular%20extension%20is%20present%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22lymphovascular_invasion%22%2C%20%22Presence%20of%20lymphovascular%20invasion%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22vascular_invasion%22%2C%20%22Presence%20of%20vascular%20invasion%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22lymph_nodes_examined%22%2C%20%22Number%20of%20lymph%20nodes%20examined%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22lymph_nodes_examined_count%22%2C%20%22Count%20of%20examined%20lymph%20nodes%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22lymph_nodes_examined_positive%22%2C%20%22Number%20of%20positive%20lymph%20nodes%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22perineural_invasion%22%2C%20%22Presence%20of%20perineural%20invasion%22%5D%0A%20%20%20%20%5D)%0A%0A%20%20%20%20treatment_data_table%20%3D%20create_table(%5B%0A%20%20%20%20%20%20%20%20%5B%22radiation_treatment_adjuvant%22%2C%20%22Adjuvant%20radiation%20therapy%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22pharmaceutical_tx_adjuvant%22%2C%20%22Adjuvant%20pharmaceutical%20treatment%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22treatment_outcome_first_course%22%2C%20%22Outcome%20of%20the%20first%20course%20of%20treatment%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22targeted_molecular_therapy%22%2C%20%22Targeted%20molecular%20therapy%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22definitive_surgical_procedure%22%2C%20%22Definitive%20surgical%20procedure%20performed%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22surgical_procedure_first%22%2C%20%22First%20surgical%20procedure%20performed%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22margin_status%22%2C%20%22Surgical%20margin%20status%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22surgery_for_positive_margins%22%2C%20%22Surgery%20performed%20for%20positive%20margins%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22chemotherapy%22%2C%20%22Chemotherapy%20treatment%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22hormonal_therapy%22%2C%20%22Hormonal%20therapy%20treatment%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22immunotherapy%22%2C%20%22Immunotherapy%20treatment%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22ablation_embolization_tx_adjuvant%22%2C%20%22Ablation%20or%20embolization%20therapy%22%5D%0A%20%20%20%20%5D)%0A%0A%20%20%20%20genetic_mutations_table%20%3D%20create_table(%5B%0A%20%20%20%20%20%20%20%20%5B%22kras_gene_analysis_indicator%22%2C%20%22Indicator%20of%20KRAS%20gene%20analysis%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22kras_mutation_found%22%2C%20%22KRAS%20mutation%20found%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22kras_mutation_codon%22%2C%20%22KRAS%20mutation%20codon%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22braf_gene_analysis_indicator%22%2C%20%22Indicator%20of%20BRAF%20gene%20analysis%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22braf_gene_analysis_result%22%2C%20%22BRAF%20gene%20analysis%20result%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22p53_gene_analysis%22%2C%20%22p53%20gene%20analysis%20result%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22egfr_mutation_status%22%2C%20%22EGFR%20mutation%20status%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22egfr_mutation_identified_type%22%2C%20%22Type%20of%20EGFR%20mutation%20identified%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22eml4_alk_translocation_status%22%2C%20%22EML4-ALK%20translocation%20status%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22idh1_mutation_test_indicator%22%2C%20%22IDH1%20mutation%20test%20indicator%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22idh1_mutation_found%22%2C%20%22IDH1%20mutation%20found%22%5D%2C%0A%20%20%20%20%20%20%20%20%5B%22her2_status_by_ihc%22%2C%20%22HER2%20status%20determined%20by%20IHC%22%5D%0A%20%20%20%20%5D)%0A%0A%20%20%20%20%23%20Create%20tabs%20using%20a%20dictionary%0A%20%20%20%20tabs%20%3D%20mo.ui.tabs(%7B%0A%20%20%20%20%20%20%20%20%22Patient%20Demographics%20%26%20History%22%3A%20patient_demographics_table%2C%0A%20%20%20%20%20%20%20%20%22Tumor%20Characteristics%20%26%20Diagnosis%22%3A%20tumor_characteristics_table%2C%0A%20%20%20%20%20%20%20%20%22Cancer%20Staging%22%3Acancer_staging_table%2C%0A%20%20%20%20%20%20%20%20%22Metastasis%20Cancer%20Data%22%3A%20metastasis_table%2C%0A%20%20%20%20%20%20%20%20%22Treatments%20Data%22%3A%20treatment_data_table%2C%0A%20%20%20%20%20%20%20%20%22Genetic%20Mutations%22%3A%20genetic_mutations_table%0A%0A%20%20%20%20%7D)%0A%0A%20%20%20%20tabs%0A%20%20%20%20return%20(%0A%20%20%20%20%20%20%20%20cancer_staging_table%2C%0A%20%20%20%20%20%20%20%20create_table%2C%0A%20%20%20%20%20%20%20%20genetic_mutations_table%2C%0A%20%20%20%20%20%20%20%20metastasis_table%2C%0A%20%20%20%20%20%20%20%20patient_demographics_table%2C%0A%20%20%20%20%20%20%20%20tabs%2C%0A%20%20%20%20%20%20%20%20treatment_data_table%2C%0A%20%20%20%20%20%20%20%20tumor_characteristics_table%2C%0A%20%20%20%20)%0A%0A%0A%40app.cell%0Adef%20_(BRCA_CV%2C%20mo)%3A%0A%20%20%20%20mo.ui.data_explorer(BRCA_CV)%0A%20%20%20%20return%0A%0A%0A%40app.cell(hide_code%3DTrue)%0Adef%20_(mo)%3A%0A%20%20%20%20mo.md(%0A%20%20%20%20%20%20%20%20r%22%22%22%0A%20%20%20%20%20%20%20%20%23%23%23%3Cspan%20style%3D%22color%3A%20Green%22%3EUse%20correlation%20matrices%20to%20find%20relationships%20between%20genes%20and%20patient%20features.%3C%2Fspan%3E%0A%0A%20%20%20%20%20%20%20%20I%20would%20like%20to%20see%20the%20correlation%20between%20the%20cancerous%20and%20non%20cancerous%20genes%20and%20patiens%20demographic%0A%20%20%20%20%20%20%20%20%22%22%22%0A%20%20%20%20)%0A%20%20%20%20return%0A%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20app.run()%0A
cd8a02ea33dc465746f9e171821785a801728d5e97913e15c74dfabceb2bd221